function [centerx,centery] = getCenter(img,Msize)
 Timg = reshape(img,Msize,Msize);
 lrow = 20; hrow = 44;lcol = 20;hcol = 44 ;
 sumq = 0;sumcolq = 0; sumrowq = 0;
 for row = lrow:hrow
     for col = lcol : hcol
         q = Timg(row,col); 
         sumq = sumq + q;
         sumcolq = sumcolq + q*col;
         sumrowq = sumrowq + q*row;
     end
 end
 centerx = (sumcolq/sumq);
 centery = (sumrowq/sumq);